home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / shots / DeathBall.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  3.2 KB  |  110 lines

  1. class classes.shots.DeathBall
  2. {
  3.    var x;
  4.    var y;
  5.    var id;
  6.    var clip;
  7.    var cv;
  8.    var trans;
  9.    var colorTrans;
  10.    var xMov = 0;
  11.    var yMov = 0;
  12.    var xMovT = 0;
  13.    var yMovT = 0;
  14.    var c = 0;
  15.    var power = 30;
  16.    var Name = "deathBall";
  17.    function DeathBall(px, py, pxMov, pyMov, pid)
  18.    {
  19.       this.x = px;
  20.       this.y = py;
  21.       this.id = pid;
  22.       this.xMov = pxMov;
  23.       this.yMov = pyMov;
  24.       _root.d = _root.d + 1;
  25.       this.clip = _root.attachMovie("deathBall","deathBall" + this.id + "Clip",_root.d);
  26.       this.clip._x = this.x;
  27.       this.clip._y = this.y;
  28.       this.cv = 0.5;
  29.       this.xMov *= _root.dif.speed;
  30.       this.yMov *= _root.dif.speed;
  31.       var _loc5_ = _root.randRange(-10,10);
  32.       var _loc4_ = _root.randRange(-75,75);
  33.       var _loc3_ = _root.randRange(-20,20);
  34.       this.trans = new flash.geom.Transform(this.clip);
  35.       this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,_loc5_,_loc4_,_loc3_,0);
  36.       this.trans.colorTransform = this.colorTrans;
  37.    }
  38.    function main()
  39.    {
  40.       this.c = this.c + 1;
  41.       this.clip.fizzle1._x = _root.randRange(1,5) * 3;
  42.       this.clip.fizzle1._y = _root.randRange(1,5) * 3;
  43.       this.clip.fizzle1._alpha = _root.randRange(5,40);
  44.       this.clip.fizzle2._x = _root.randRange(1,5) * 3;
  45.       this.clip.fizzle2._y = _root.randRange(1,5) * 3;
  46.       this.clip.fizzle2._alpha = _root.randRange(5,40);
  47.       this.clip.fizzle3._x = _root.randRange(1,5) * 3;
  48.       this.clip.fizzle3._y = _root.randRange(1,5) * 3;
  49.       this.clip.fizzle3._alpha = _root.randRange(5,40);
  50.       this.clip.fizzle4._x = _root.randRange(1,5) * 3;
  51.       this.clip.fizzle4._y = _root.randRange(1,5) * 3;
  52.       this.clip.fizzle4._alpha = _root.randRange(5,40);
  53.       this.clip.fizzle5._x = _root.randRange(1,5) * 3;
  54.       this.clip.fizzle5._y = _root.randRange(1,5) * 3;
  55.       this.clip.fizzle5._alpha = _root.randRange(5,40);
  56.       if(this.c < 30)
  57.       {
  58.          this.xMovT *= 0.9;
  59.          this.yMovT *= 0.9;
  60.       }
  61.       else if(this.c == 30)
  62.       {
  63.          var _loc3_ = _root.getAngleRad(this.x,this.y);
  64.          this.xMovT = Math.cos(_loc3_) * _root.randRange2(4,7);
  65.          this.yMovT = Math.sin(_loc3_) * _root.randRange2(4,7);
  66.       }
  67.       else
  68.       {
  69.          this.xMovT *= 1.1;
  70.          this.yMovT *= 1.1;
  71.       }
  72.       if(this.clip.hitTest(_root[_root.char + "Clip"]))
  73.       {
  74.          _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
  75.       }
  76.       if(this.x > 1050 || this.x < -50 || this.y > 650 || this.y < -50)
  77.       {
  78.          _root.removeEnemyShot("deathBall" + this.id);
  79.       }
  80.       if(this.xMovT < this.xMov)
  81.       {
  82.          this.xMov -= this.cv;
  83.       }
  84.       else if(this.xMovT > this.xMov)
  85.       {
  86.          this.xMov += this.cv;
  87.       }
  88.       else
  89.       {
  90.          this.xMov = this.xMovT;
  91.       }
  92.       if(this.yMovT < this.yMov)
  93.       {
  94.          this.yMov -= this.cv;
  95.       }
  96.       else if(this.yMovT > this.yMov)
  97.       {
  98.          this.yMov += this.cv;
  99.       }
  100.       else
  101.       {
  102.          this.yMov = this.yMovT;
  103.       }
  104.       this.x += this.xMov;
  105.       this.y += this.yMov;
  106.       this.clip._x = this.x;
  107.       this.clip._y = this.y;
  108.    }
  109. }
  110.